home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / mgr / sparcmgr / src.zoo / src / scroll.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-03-17  |  2.0 KB  |  63 lines

  1. /*                        Copyright (c) 1987 Bellcore
  2.  *                            All Rights Reserved
  3.  *       Permission is granted to copy or use this program, EXCEPT that it
  4.  *       may not be sold for profit, the copyright notice must be reproduced
  5.  *       on copies, and credit should be given to Bellcore where it is due.
  6.  *       BELLCORE MAKES NO WARRANTY AND ACCEPTS NO LIABILITY FOR THIS PROGRAM.
  7.  */
  8. /*    $Header: scroll.c,v 1.1 89/03/17 08:21:20 sau Exp $
  9.     $Source: /m1/mgr.new/src/RCS/scroll.c,v $
  10. */
  11. static char    RCSid_[] = "$Source: /m1/mgr.new/src/RCS/scroll.c,v $$Revision: 1.1 $";
  12.  
  13. /*****************************************************************************
  14.  *    scroll a bitmap
  15.  */
  16.  
  17. #include <stdio.h>
  18. #include "bitmap.h"
  19. #include "defs.h"
  20. #include "clip.h"
  21.  
  22. scroll(win,map,start,end,delta,op)
  23. register WINDOW *win;    /* window to scroll */
  24. register BITMAP *map;    /* bitmap in window to scroll */
  25. int start,end,delta;    /* starting line, ending line, # of lines */
  26.    {
  27.    register int ems = end-start;
  28.    if (delta > 0) {
  29.       if (end-start > delta)
  30. #ifdef ALIGN
  31.          if (win->window == map) {
  32. #ifdef DEBUG
  33.             dprintf(F)(stderr,"fast scroll %s\r\n",W(tty));
  34. #endif
  35.             /* special high-speed byte-aligned scroller */
  36.  
  37.             fast_scroll(map,BIT_X(map),BIT_Y(map) + start,
  38.                      (7&(BIT_X(map))) + BIT_WIDE(map) + SUM_BDR,
  39.                      end-start,delta);
  40.             }
  41.          else
  42. #endif ALIGN
  43.             bit_blit(map,0,start,BIT_WIDE(map),ems-delta,
  44.                    BIT_SRC,map,0,start+delta);
  45.       bit_blit(map,0,end-delta,BIT_WIDE(map),delta,op,NULL_DATA,0,0);
  46.       }
  47.  
  48.    else if (delta < 0) {
  49.       if (ems + delta > 0)
  50.          bit_blit(map,0,start-delta,BIT_WIDE(map),ems+delta,
  51.              BIT_SRC,map,0,start);
  52.       bit_blit(map,0,start,BIT_WIDE(map),-delta,op,NULL_DATA,0,0);
  53.       }
  54.    
  55.  
  56.    if (Do_clip()) 
  57.       Set_clip(W(text).x,
  58.                W(text).y + start,
  59.                W(text).x + BIT_WIDE(map),
  60.                W(text).y + BIT_HIGH(map)
  61.               );
  62.    }
  63.